<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>

<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.lable.drugqualityspecSeeStd"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="${ctx}/lib/js/html5shiv.min.js"></script>
        <script src="${ctx}/lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
                            
    <section class="content-header">
        <h1>药品采购情况</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
                <li><a href="#">统计与查询</a></li>
                <li><a href="#">药品采购情况</a></li>
        </ol>
    </section>
    <section class="content">
		 <div class=" box box-success">
            <div class="box-body">
             <form  id="form" action='' method="post">
                <div class="input">
                	<div class="textalign1">年度<spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <table style="width:100%">
                                <tr>
                                    <td style="width:50%">
                                        <input id="startDate" type="datetime" name="starttime" class="textinput" placeholder="yyyy-MM" />
                                    </td>
                                    <td>&nbsp;-&nbsp;</td>
                                    <td style="width:50%">
                                        <input id="endDate"  type="datetime" name="endtime" class="textinput"  placeholder="yyyy-MM" /> 
                                    </td> 
                                </tr>
                         </table>
                    </div>
                    <div class="textalign1">药品分类<spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                       	<select class="textinput" id='drugCat' name='drugCat' >
                       		<option value='' >请选择</option>
                       		<option value='1' >西药</option>
                       		<option value='2,3' >中药</option>
                       	</select>
                    </div>
                     <div class="textalign" >
                         <button id="selectSpec" type="button" onclick="search();" class="btn btn-success btn-sm"><spring:message code="message.button.seachSpacing"/></button>
                    </div>
                </div>
            </form>
            </div>
          </div>
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        <div class=" box box-warning bottongroup">
            <a href="javascript:history.go(-1)" class="btn btn-danger btn-sm" >返 回</a>
        </div>
    </section>
      <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
        $(function () {
        	var datetime =$("input[type='datetime']");
       	    var start = datetime.eq(0);
       	 	var end = datetime.eq(1);
       		start.on('focus',function(){
        		WdatePicker({maxDate:"#F{$dp.$D('"+end.attr("id")+"')}",dateFmt:"yyyy-MM"});
        	})
        	end.on('focus',function(){
        		WdatePicker({minDate:"#F{$dp.$D('"+start.attr("id")+"')}",dateFmt:"yyyy-MM"});
        	});
       		var obj ={
    	 			"names": [
                       '月度',
                       '通用名',
                       '剂型',
                       '规格',
                       '转换系数',
                       '包装单位', 
                       '生产企业',
                       '药品分类',
                       '采购总金额(万)', 
                       '配送金额(万)',
                       '配送率',
                       '入库金额(万)',
   					   '入库率'
                   ],
                  "model": [
                             { name: 'date', width: 80, align:"center", sortable: false},
                             { name: 'drug_name', width: 100, align:"center", sortable: false },
                             { name: 'form_name', width: 60, align:"center", sortable: false},
                             { name: 'spec_name', width: 60, align:"center", sortable: false},
                             { name: 'factor', width: 60, align:"center", sortable: false},
                             { name: 'unit_name', width: 60, align:"center", sortable: false},
                             { name: 'prod_compname', width: 100, align:"center", sortable: false},
                             { name: 'drug_cat', width: 60, align:"center", sortable: false},
                             { name: 'total_amount', width: 75, align:"center", sortable: false},
                             { name: 'del_amount', width: 80, align:"center", sortable: false},
                             { name: 'del_ratio', width: 80, align:"center", sortable: false},
                             { name: 'recp_amount', width: 80, align:"center", sortable: false},
                             { name: 'recp_ratio', width: 80, align:"center", sortable: false}

                         ]
       		};
            $("#gridlist").jqGrid({
                url: "${ctx}/anaDruginfo/getAnaHospdruginfoTotalYear.html",
                postData:{hospCode:"${hospCode}",date:"${date}"},
                mtype: "post",
                datatype: "json",
                autowidth: true,
                height: 310,
                colNames: obj.names,
                colModel: obj.model,
                rowNum: 20,
                rowList: [10, 20, 50,100],
                rownumbers: true,
                pager: "#gridpage",
                multiselect: false, 
                viewrecords: true,
                caption: "<c:out value='${hospName}'></c:out>采购药品列表",
                gridComplete:function(){
                    autoRNWidth("gridlist");
                },
                jsonReader: {
                	 repeatitems: false,
                    id: "qualitySpecId"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
            $('#exportExcel').bind('click',function(){
            	$("#form").attr("action","${ctx}/anaDruginfo/exportExcelWithYear.html?"+gridParam("#gridlist"))
            	.submit();
            });
        });
        function search(page) {
        	var data =formatForm("form");
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:data,
                page : (page || 1)
            }).trigger("reloadGrid"); //重新载入  
        }
        
    </script>
</body>
</html> 
                          
                  
                  